﻿/////////////////////////////////////////////////////////////////
//File: ArticleInfo.cs
//Description: 
//  Ajax 代码
//  
//Copyright© 2011 Moliu
//History:
//  2011-2-23 23:28:31    CodeSmith5.0.1    Original Version
/////////////////////////////////////////////////////////////////

using System;
using System.Threading;
using System.Collections.Generic;
using System.IO;
using MAF.Common;
using My.Blog.Domain.Entities;
using My.Blog.Domain.Interfaces;
using My.Blog.Business.Service;
using My.Blog.Business.Security;
using My.Blog.Web.Controllers;
using System.Web;
using System.Configuration;
using System.Collections.Specialized;

namespace My.Blog.Web.UI_MAF_Template
{
    public class CreateBlog : My.Blog.Web.Controllers.BasePage
    {
        public CreateBlog()
        {
            HttpContext context = HttpContext.Current;

            // 标签
            const string IF_MAINTAIN = "If:Maintain";

            // 模板路径及逻辑标签正则表达式
            string TPL_FILE_PATH = ConfigurationManager.AppSettings["TemplatesPath"] + @"/CreateBlog.html";

            if(true==this.IsMasterMode)
            {
                // 模板处理对象
                string tpl = File.ReadAllText(context.Server.MapPath(TPL_FILE_PATH));
                Template tplEntity = new Template(tpl);
                NameValueCollection map = new NameValueCollection();
                map.Add("{RootUrl}", this.RootUrl);
                map.Add("{UserId}", SecurityUtility.UserId);
                       
                tplEntity.Replace(map);
                
                context.Response.Write(tplEntity.Result);
            }
        }
    }
}
